﻿#ifndef SPIDER_H
#define SPIDER_H

#include <QObject>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QTimer>
#include <QVariant>
#include <QApplication>
#include <QList>
#include <QFileInfo>
#include <QDir>

struct dataType
{
    QString title;
    QString href;
};

class Spider : public QObject
{
    Q_OBJECT
public:
    explicit Spider(QObject *parent = nullptr);
    ~Spider();

signals:

public slots:

private slots:
    void replyFinished(QNetworkReply *);
    void httpReadyRead();
    void writeFile(QString path="output.txt", QString data="");
    void get(QUrl url);
    void handleData();                                    //handle dir
    void handleFileData(QString title, QString href);     //handle file

private:
    QNetworkAccessManager *manager;
    QTimer timer;
    QNetworkReply *reply;
    QString all;
};

#endif // SPIDER_H
